Load libraries

library(leaflet)
library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Project Summary

Read 2017 Car crash data in Allegheny County.

DF<-read.csv("CarCrash2017.csv")

Interactive MAP - Total car crash by month

Subset the location of the car crash

dfCrash<-select(DF,DEC_LAT,DEC_LONG,CRASH_MONTH)
colnames(dfCrash)<-c("latitude","longitude","Month Crash")
dfCrash<-dfCrash %>% drop_na()
CarsIcon <- makeIcon("CarsIcon1.png",iconWidth = 45, iconHeight = 45)

2017 Car crash data of Allegheny County

Interactive MAP - Fatlity car crash by month

Add a new column which will contains the number of fatilties.

DF<-mutate(DF,Death.Count=BICYCLE_DEATH_COUNT+BELTED_DEATH_COUNT+MCYCLE_DEATH_COUNT+PED_DEATH_COUNT+UNB_DEATH_COUNT)
dfCrash<-select(DF,DEC_LAT,DEC_LONG,Death.Count)
colnames(dfCrash)<-c("latitude","longitude","Death.Count")